<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
import { actionTypes as appActionTypes } from "@/store/modules/app";
import { actionTypes as authActionTypes } from "@/store/modules/auth";
export default {
  name: "App",
  watch: {
    $route(nv) {
      if (nv) {
        this.setTabOrHeaderStatus(nv);
      }
    },
  },
  mounted() {
    this.setTabOrHeaderStatus(this.$route);
  },
  methods: {
    setTabOrHeaderStatus(route) {
      this.$store.dispatch(appActionTypes.setRoute, route);
      this.$store.dispatch(appActionTypes.setTabShow);
      this.$store.dispatch(appActionTypes.setHeaderShow);
      this.$store.dispatch(appActionTypes.setHeaderBackShow);
      this.$store.dispatch(appActionTypes.setHeaderRightShow);

      this.$store.dispatch(authActionTypes.getCurrentUser);
    },
  },
};
</script>

<style></style>
